# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=pygments-github-lexers
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.0.5
pkgrel=1
pkgdesc="Pygments Github custom lexers. (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url='https://github.com/liluo/pygments-github-lexers'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python" 
         "${MINGW_PACKAGE_PREFIX}-python-pygments")
makedepends=("${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz"
        "LICENSE")
sha256sums=('aaca57e77cd6fcfce8d6ee97a998962eebf7fbb810519a8ebde427c62823e133'
            '6593a71d433e2e4c9ef686c7ed0803faa661124ef3b50a0bac7e829034666c2f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"

  ## (OPTIONAL) Only if setuptools-scm is used
  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}

build() {
  cd "${srcdir}"
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  "${MINGW_PREFIX}"/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    "${MINGW_PREFIX}"/bin/python setup.py install --prefix="${MINGW_PREFIX}" \
      --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 ${srcdir}/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
